#include "leds.h"

#include "bsp/bsp_led.h"

void leds_toggle(uint32_t leds) {
  for (int i = 0; i < LED_COUNT; i++) {
    if (leds & (1 << i)) {
      bsp_gpio_toggle_pin(board_leds[i].port, board_leds[i].pin);
    }
  }
}
void leds_on(uint32_t leds) {
  for (int i = 0; i < LED_COUNT; i++) {
    if (leds & (1 << i)) {
      if (board_leds[i].active_level) {
        bsp_gpio_set_pin(board_leds[i].port, board_leds[i].pin);
      } else {
        bsp_gpio_clear_pin(board_leds[i].port, board_leds[i].pin);
      }
    }
  }
}
void leds_off(uint32_t leds) {
  for (int i = 0; i < LED_COUNT; i++) {
    if (leds & (1 << i)) {
      if (board_leds[i].active_level) {
        bsp_gpio_clear_pin(board_leds[i].port, board_leds[i].pin);
      } else {
        bsp_gpio_set_pin(board_leds[i].port, board_leds[i].pin);
      }
    }
  }
}